<?php
namespace Admin\Controller;
use Think\Controller;
class EditGameController extends Controller {
    public function index() {
        $this->display('./Public/admin/edit_game.html');
    }

    public function save() {
        if (!empty($_POST))
        {
            $map['title'] = $_POST['title'];
            $map['pid'] = intval($_POST['pid']);
            $map['flash'] = intval($_POST['flash']);

            $game = D('Game');
            if ($game->create($map)) {
                if ($game->add()) {
                    $this->success('新增成功', U('Admin/Index/game'), 3);
                } else $this->error('新增失败');
            } else $this->error('create失败');
        }
    }
}